#include <iostream>
#include <vector>

using namespace std;

// 1343. 大小为 K 且平均值大于等于阈值的子数组数目
// https://leetcode.cn/problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold/description/


class Solution {
public:
    int numOfSubarrays(vector<int>& arr, int k, int threshold) {
        int left = 0;
        int cnt = 0;
        int ans = 0;
        for (int i = 0; i < arr.size(); i++){
            cnt += arr[i];
            if(i - left  + 1 < k){
                continue;
            }
            if(cnt / k >= threshold){
                ans++;
            }
            cnt -= arr[left++];
        }
        return ans;
    }
};

int main()
{
    return 0;
}